#ifndef _GORBATRAS_FBXHELPER
#define _GORBATRAS_FBXHELPER

#include "Gorbatras_Library.h"

namespace GC
{
	//A static class with only static variables and functions
	//It has utility functions that doesn't really belong in any class
	class FbxHelper
	{
		public:
			class FbxPoseData
			{
				public:
					FbxPoseData( const FbxNode* a_node );					
					const FbxPose* m_pose;
					/// <summary>
					/// Is -1 if no pose was found
					/// Else it's the index of the node 
					/// </summary>
					int m_poseFindResult;
			};

			static const double PI;
			static const double Euler2Rad;
			
			static const int GetNodeID(const FbxNode* a_node);
			static const bool IsRootNode(const FbxNode* a_node);
			
			//It returns whichever depending on ConverterSettings usingDualQuaternion boolean			
			static VectorConstDouble GetDQorMatrix4x4();
			static const int GetDQorMatrix4x4Length();
			//Returns a Quaternion based on the wikipedia formula
			static FbxQuaternion GetQuaternion(const FbxVector4 a_rotation, const bool a_isEuler = false );

			static void SetDQorMat4x4FromMat(const FbxAMatrix a_src, VectorConstDouble& a_dest);
			static void SetDQorMat4x4FromDQ(const FbxDualQuaternion a_src, VectorConstDouble& a_dest);
			static void SetDQorMat4x4FromTR(const FbxVector4 a_translation, const FbxVector4 a_rotation, VectorConstDouble& a_dest);

			static void SetDualQuaternion(const FbxAMatrix a_src, VectorConstDouble& a_dest);
			static void SetDualQuaternion(const FbxDualQuaternion a_src, VectorConstDouble& a_dest);
			//Get the global position matrix for a node
			static FbxAMatrix GetGlobalPosition(FbxNode* a_node,const FbxPose* a_pose, FbxAMatrix* a_parentGlobalPosition = nullptr);
			//Get the Geometry for a FbxNode*
			static FbxAMatrix GetGeometry(const FbxNode* a_node);
			static FbxAMatrix GetPoseMatrix( const FbxPose* a_pose, const int a_poseFindResult);
			//Reserves the memory for a_reserveSize many FbxNode* pointers
			static void ReserveNodeMap( const int a_reserveSize );
			//Adds a FbxNode* to the nodemap
			static void AddToMap( const FbxNode* a_node ); 
			static void ClearNodeMap();
		private:
			FbxHelper();

			static const int DQLength;
			static const int Matrix4x4Length;
			
			static std::vector<const FbxNode*> s_nodeMap;
			
	};
}

#endif